from django.db import models


class ImageModel(models.Model):
    objects = models.Manager()
    name = models.CharField(max_length=100)
    image_path = models.CharField(max_length=255)  # 存储图片的路径
    #                                                                                        parent.children 能找到所有parent是自己的图片
    parent = models.ForeignKey('self', on_delete=models.SET_NULL, null=True, blank=True, related_name='children')  # 指向父图片

    class Meta:
        db_table = 'top_image_path'
